package net.fkrahe.graph;

import java.util.LinkedList;

/**
 * Class Graph Node
 * 
 * @author Yedidyah Langsan | Moshe Augenstein | Aaron M. Tenenbaum
 */
public class GraphNode {

    private Object info;
    private LinkedList<ArcNode> arcptr;

    public GraphNode(Object info) {
        this.info = info;
        this.arcptr = null;
    }

    public GraphNode(Object info, LinkedList<ArcNode> arcptr) {
        this.info = info;
        this.arcptr = arcptr;
    }

    public Object getInfo() {
        return info;
    }

    public void setInfo(Object o) {
        info = o;
    }

    public LinkedList<ArcNode> getArcptr() {
        return arcptr;
    }

    public void setArcptr(LinkedList<ArcNode> n) {
        arcptr = n;
    }

    public boolean equals(Object o) {
        if (!(o instanceof GraphNode)) {
            return false;
        }
        GraphNode gn = (GraphNode) o;
        return info.equals(gn.info);
    }

    @Override
    public String toString() {
        if (info != null) {
            return info.toString();
        } else {
            return super.toString();
        }
    }
}
